package com.larry.mr2.comparator;

import com.larry.mr2.comparable.FlowBean;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class CustomComparator extends WritableComparator {

    //指定服务对象
    public CustomComparator() {
        super(FlowBean.class,true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {

        FlowBean abean = (FlowBean) a;
        FlowBean bbean = (FlowBean) b;

        return abean.getSumFlow().compareTo(bbean.getSumFlow());

    }
}
